<template>
    <xc-form ref="refForm" v-bind="$attrs" :inline="inline" :form-data="formData" :columns="columns"
             :col-config="colConfig" :is-auto="isAuto" :rules="formRules" :inline-message="inlineMessage"
    ></xc-form>
</template>

<script lang="ts">
import { defineComponent, ref, PropType } from 'vue';
import XcForm from '@x-tech/fe-pc-components/src/components/XcForm/index.vue';
import { ColConfig, ColumnsItem } from '@x-tech/fe-pc-components/src/components/XcForm/types';

export default defineComponent({
    name: 'baseForm',
    components: {
        XcForm,
    },
    props: {
        // 表单校验
        formRules: {
            type: Object,
            default: null,
        },
        // 设置isAuto后 col将不生效
        isAuto: {
            type: Boolean,
            default: true,
        },
        // 列信息
        columns: {
            type: Array as PropType<ColumnsItem[]>,
            default: () => [],
            requird: true,
        },
        // 响应式列配置
        colConfig: {
            type: Object as PropType<ColConfig>,
            default: () => ({
                xs: 2,
                sm: 3,
                md: 4,
                lg: 5,
            }),
        },
        // 表单初始化数据
        formData: {
            type: Object,
            default: () => ({}),
        },
        inline: {
            type: Boolean,
            default: true,
        },
        inlineMessage: {
            type: Boolean,
            default: true,
        }
    },
    setup(props, { emit, attrs }) {
        // 表单相关
        const refForm: any = ref(null);
        return {
            refForm
        };
    },
});
</script>

